<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('矿机托管id');
            $table->unsignedInteger('user_id')->comment('用户ID');
            $table->string('pool_name')->comment('挖矿币种名称');
            $table->unsignedInteger('number')->comment('托管算力/T');
            $table->decimal('price', 20, 8)->comment('托管价格');
            $table->unsignedInteger('month')->comment('托管月数');
            $table->decimal('total', 20, 8)->comment('托管费用');
            $table->timestamp('finish_at')->comment('到期时间');
            $table->signedTinyInteger('status')->default(1)->comment('矿机状态 -1-已取消 0-已过期  1-进行中');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}
